<%--
  Created by IntelliJ IDEA.
  User: 李先生
  Date: 2024/11/26
  Time: 下午7:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-image: url('./picture/bjImages/1.jpg'); /* 添加背景图片 */
            background-size: cover; /* 让背景图片覆盖整个视口 */
            background-position: center; /* 背景图片居中 */
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            /* 使用视口高度来居中 */
            color: black; /* 改为黑色 */
        }

        .container {
            width: 400px;
            background-color: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        .container h2 {
            text-align: center;
            color: black; /* 改为黑色 */
        }

        .form-group {
            margin: 15px 0;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
        }

        .form-group input {
            width: 94%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        .form-group input:focus {
            border-color: #5cb85c;
            outline: none;
        }

        .btn {
            width: 100%;
            padding: 10px;
            background-color: #5cb85c;
            border: none;
            color: white;
            border-radius: 4px;
            cursor: pointer;
        }

        .btn:hover {
            background-color: #4cae4c;
        }

        .footer {
            text-align: center;
            margin-top: 20px;
            color: #777;
        }
    </style>
</head>
<body>
<div class="container">
    <h2>注册账户</h2>
    <form action="register.do" method="post">
        <div class="form-group">
            <label for="realName">真实姓名</label>
            <input type="text" id="realName" name="realName" required>
        </div>
        <div class="form-group">
            <label for="username">用户名</label>
            <input type="text" id="username" name="username" required>
        </div>
        <div class="form-group">
            <label for="email">邮箱</label>
            <input type="email" id="email" name="email" required>
        </div>
        <div class="form-group">
            <label for="phone">用户手机</label>
            <input type="tel" id="phone" name="phone">
        </div>
        <div class="form-group">
            <label for="password">密码</label>
            <input type="password" id="password" name="password" required>
        </div>
        <div class="form-group">
            <label for="confirmPassword">密码确认</label>
            <input type="password" id="confirmPassword" name="confirmPassword" required>
        </div>
        <div class="show-password">
            <input type="checkbox" id="showPassword">
            <label for="showPassword">显示密码</label>
        </div>
        <button type="submit" class="btn">注册</button>
    </form>
    <div class="footer">
        <p>已拥有账户？<a href="login.jsp">点击这里登录</a></p>
    </div>
</div>
<script>
    const showPasswordCheckbox = document.getElementById("showPassword");
    const passwordInput = document.getElementById("password");
    const confirmPasswordInput = document.getElementById("confirmPassword");

    showPasswordCheckbox.addEventListener("change", function () {
        if (this.checked) {
            passwordInput.setAttribute("type", "text"); // 显示密码
            confirmPasswordInput.setAttribute("type", "text"); // 显示确认密码
        } else {
            passwordInput.setAttribute("type", "password"); // 隐藏密码
            confirmPasswordInput.setAttribute("type", "password"); // 隐藏确认密码
        }
    });
</script>
</body>
</html>
